home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / INTERNET / SITES / GRAHAM / XAAES_S.ZIP / XAAES / APPLSEAR.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-29  |  1.2 KB  |  68 lines

  1. /*
  2.  * XaAES - XaAES Ain't the AES
  3.  *
  4.  * A multitasking AES replacement for MiNT
  5.  *
  6.  */
  7.  
  8. #include <MINTBIND.H>
  9. #include <OSBIND.H>
  10. #include <memory.h>
  11. #include <strings.h>
  12. #include "XA_DEFS.H"
  13. #include "XA_TYPES.H"
  14. #include "XA_GLOBL.H"
  15. #include "K_DEFS.H"
  16. #include "EVNT_MUL.H"
  17.  
  18. /*
  19.     AES4.0 compatible appl_search
  20. */
  21. unsigned long XA_appl_search(short clnt_pid, AESPB *pb)
  22. {
  23.     short start_pid,cpid;
  24.     char *fname=(char*)pb->addrin[0];
  25.     
  26.     switch(pb->intin[0])
  27.     {
  28.         case 0:        /* APP_FIRST */
  29.             start_pid=clnt_pid + 1;
  30.             break;
  31.         case 1:        /* APP_NEXT */
  32.             start_pid=((short)clients[clnt_pid].temp) + 1;
  33.             break;
  34.     }
  35.     
  36.     if (start_pid>MAX_PID)
  37.         start_pid=0;
  38.     
  39.                             /* find next active client */
  40.     for(cpid=start_pid; !clients[cpid].clnt_pipe_rd; cpid++)
  41.     {
  42.         if (cpid>MAX_PID)
  43.             cpid=0;
  44.     }
  45.     
  46.     if (cpid==clnt_pid)        /* Have we looked at all the clients? */
  47.     {
  48.         pb->intout[0]=0;
  49.     }else{                    /* nope - fill in details of found client */
  50.         pb->intout[0]=1;
  51.         
  52.         if (cpid==AESpid)
  53.             pb->intout[1]=1;
  54.         else
  55.             pb->intout[1]=2;
  56.     
  57.         pb->intout[2]=cpid;
  58.  
  59.         strncpy(fname,clients[cpid].proc_name,8);
  60.         fname[8]='\0';
  61.         
  62.         clients[clnt_pid].temp=(void*)cpid;
  63.     }
  64.     
  65.     return XAC_DONE;
  66.     
  67. }
  68.